let vm = new Vue({
    el: "#index",
    data: {
        list: [],
        loading: false,
        finished: false,
        form: {
            page: 1,
            limit: 20
        },


        msgPopover: false,
        showMsg: false,
        message: "",
        radio: "yes",
        dataList: [],
        lookList: [],   //进度
        showneed: ""
    },
    methods: {
        getData() {
            leiku.post('http://dongtai.fsslpc.com/api/2020101918100890', this.form, res=> {
                console.log(res.data)
                let data = res.data
                if (data.a.length) {
                    this.finished = true // 若数据加载完毕，则直接将 finished 设置成 true
                    this.list = data.a
                }
                this.loading = false   // 数据更新完毕后，将 loading 设置成 false
            })
        },

        // 滚到底部，触发load事件
        onLoad() {
            this.form.page++;
            this.getData();
        },

        msgPopoverBtn (rowId) {
            let id = rowId || leiku.GetUrlParam('spid')
            leiku.post('http://dongtai.fsslpc.com/api/2020091023973909', { spid: id }, res => {
                let data = res.data;
                console.log(data)
                if (data.a.length) {
                    this.msgPopover = true
                    this.dataList = data.a;
                    this.lookList = data.b;
                    this.showneed = data.a[0].need
                }
            })
        },

        // 审核按钮
        clickMsgBtn() {
            this.showMsg = true;
        },
        // 审核保存按钮
        onSubmit() {
            leiku.post('http://dongtai.fsslpc.com/api/2020091807904496', {
                id: this.dataList[0].id,
                needqxzt: this.dataList[0].needqxzt,
                content: this.radio == "yes" ? this.dataList[0].yes : this.dataList[0].no,
                idea: this.message,
                shenpibh: this.dataList[0].s1,
                creator: this.dataList[0].c1,
                bmid: this.dataList[0].bmid,
                dt_dj1qko: window.localStorage.getItem('dt_dj1qko') ? JSON.parse(window.localStorage.getItem('dt_dj1qko')).str : ''
            }, res => {
                this.$toast('保存成功！')
                this.showMsg = false;
                this.msgPopover = false;
                this.getData();
                // window.location.reload();
            });
        },

    },
    mounted() {
        this.getData();
    }
})
